package com.lamatek.tags.google;

import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.TagSupport;

/**
 * GoogleMapCoordinatesTag
 * 
 * This class represents a &lt;googlemaps:coordinates> tag. Developers should not
 * extend this class or override it's methods.
 * 
 * @author Tom Cole
 * @version 0.96b
 */
public class GoogleMapCoordinatesTag extends TagSupport {

    String style = null;
    String css_class = null;
    int x = 0;
    int y = 0;
    /**
     * Overrides doStartTag() from TagSupport. Developers should not override this
     * method.
     */
    public int doStartTag() {
        Tag tag = this;
        while (tag.getParent() != null) {
            if (tag.getParent() instanceof GoogleMapTag) {
                ((GoogleMapTag) tag.getParent()).addCoordinates(this);
                return SKIP_BODY;
            }
            tag = tag.getParent();
        }
        return SKIP_BODY;
    }
    /**
     * Returns the CSS class name for the div that displays the coordinates.
     *
     * @return A CSS class name.
     */
    public String getCss_class() {
        return css_class;
    }
    /**
     * Sets the CSS class name for the div that displays the coordinates.
     * 
     * @param css_class A valid class name defined in the css.
     */
    public void setCss_class(String css_class) {
        this.css_class = css_class;
    }
    /**
     * Returns the style attribute set for the div tag that displays
     * the coordinates.
     * 
     * @return A css style attribute
     */
    public String getStyle() {
        return style;
    }
    /**
     * Sets the css style attribute for the div tag that displays
     * the coordinates.
     * 
     * @param style A valid css style string.
     */
    public void setStyle(String style) {
        this.style = style;
    }
    /**
     * Returns the x coordinate of the dov tag's upper left hand corner placement.
     * 
     * @return The x location of the upper left hand corner in pixels.
     */
    public int getX() {
        return x;
    }
    /**
     * Sets the x coordinate (in pixles) of the desired placement of the upper
     * left hand corner of the div tag that displays the coordinates.
     * 
     * @param x The placement x coordinate (in pixels)
     */
    public void setX(int x) {
        this.x = x;
    }
    /**
     * Returns the y coordinate of the dov tag's upper left hand corner placement.
     * 
     * @return The y location of the upper left hand corner in pixels.
     */
    public int getY() {
        return y;
    }
    /**
     * Sets the y coordinate (in pixles) of the desired placement of the upper
     * left hand corner of the div tag that displays the coordinates.
     * 
     * @param y The placement y coordinate (in pixels)
     */
    public void setY(int y) {
        this.y = y;
    }
}
